set_global_assignment -name FAMILY "Cyclone IV E"

set_global_assignment -name RESERVE_ALL_UNUSED_PINS_WEAK_PULLUP "AS INPUT TRI-STATED"
set_global_assignment -name STRATIX_DEVICE_IO_STANDARD "3.3-V LVTTL"
set_global_assignment -name CYCLONEII_RESERVE_NCEO_AFTER_CONFIGURATION "USE AS REGULAR IO"
set_global_assignment -name RESERVE_DATA0_AFTER_CONFIGURATION "USE AS REGULAR IO"
set_global_assignment -name RESERVE_DATA1_AFTER_CONFIGURATION "USE AS REGULAR IO"
set_global_assignment -name RESERVE_FLASH_NCE_AFTER_CONFIGURATION "USE AS REGULAR IO"
set_global_assignment -name RESERVE_DCLK_AFTER_CONFIGURATION "USE AS REGULAR IO"
set_global_assignment -name NUM_PARALLEL_PROCESSORS 4

#引脚参数导入脚本
#时钟、复位
set_location_assignment PIN_E1 -to sys_clk
set_location_assignment PIN_E15 -to sys_rst_n

# VGA
set_location_assignment PIN_C15 -to vga_rgb[0] 
set_location_assignment PIN_B16 -to vga_rgb[1] 
set_location_assignment PIN_A15 -to vga_rgb[2] 
set_location_assignment PIN_B14 -to vga_rgb[3] 
set_location_assignment PIN_A14 -to vga_rgb[4] 
set_location_assignment PIN_B13 -to vga_rgb[5] 
set_location_assignment PIN_A13 -to vga_rgb[6] 
set_location_assignment PIN_B12 -to vga_rgb[7] 
set_location_assignment PIN_A12 -to vga_rgb[8] 
set_location_assignment PIN_B11 -to vga_rgb[9] 
set_location_assignment PIN_A11 -to vga_rgb[10]
set_location_assignment PIN_B10 -to vga_rgb[11]
set_location_assignment PIN_A10 -to vga_rgb[12]
set_location_assignment PIN_B9 	-to vga_rgb[13]
set_location_assignment PIN_A9 	-to vga_rgb[14]
set_location_assignment PIN_C8 	-to vga_rgb[15]
set_location_assignment PIN_C16 -to vga_hs
set_location_assignment PIN_D15 -to vga_vs

#cmos an5640 module  摄像头
set_location_assignment PIN_F6  -to   cam_vsync
set_location_assignment PIN_D1  -to   cam_href 
set_location_assignment PIN_D5  -to   cam_pclk 
set_location_assignment PIN_F5  -to   cam_data[0]
set_location_assignment PIN_G5  -to   cam_data[1] 
set_location_assignment PIN_D4  -to   cam_data[2]   
set_location_assignment PIN_M1  -to   cam_data[3] 
set_location_assignment PIN_F3  -to   cam_data[4] 
set_location_assignment PIN_F2  -to   cam_data[5] 
set_location_assignment PIN_E5  -to   cam_data[6] 
set_location_assignment PIN_C3  -to   cam_data[7] 
set_location_assignment PIN_D3  -to   cam_xclk 
set_location_assignment PIN_F1  -to   cam_rst_n  
set_location_assignment PIN_G2  -to   cam_pwdn 
set_location_assignment PIN_C6  -to   cam_scl 
set_location_assignment PIN_D6  -to   cam_sda 


#SDRAM
    #地址
set_location_assignment PIN_T8    -to sdram_addr[0]  
set_location_assignment PIN_P9    -to sdram_addr[1]
set_location_assignment PIN_T9    -to sdram_addr[2]
set_location_assignment PIN_R9    -to sdram_addr[3]
set_location_assignment PIN_L16   -to sdram_addr[4]
set_location_assignment PIN_L15   -to sdram_addr[5]
set_location_assignment PIN_N16   -to sdram_addr[6]
set_location_assignment PIN_N15   -to sdram_addr[7]
set_location_assignment PIN_P16   -to sdram_addr[8]
set_location_assignment PIN_P15   -to sdram_addr[9]
set_location_assignment PIN_R8    -to sdram_addr[10]
set_location_assignment PIN_R16   -to sdram_addr[11]
set_location_assignment PIN_T15   -to sdram_addr[12]
    
    #数据
set_location_assignment PIN_R5    -to sdram_data[0]
set_location_assignment PIN_T4    -to sdram_data[1]
set_location_assignment PIN_T3    -to sdram_data[2]
set_location_assignment PIN_R3    -to sdram_data[3]
set_location_assignment PIN_T2    -to sdram_data[4]
set_location_assignment PIN_R1    -to sdram_data[5]
set_location_assignment PIN_P2    -to sdram_data[6]
set_location_assignment PIN_P1    -to sdram_data[7]
set_location_assignment PIN_R13   -to sdram_data[8]
set_location_assignment PIN_T13   -to sdram_data[9]
set_location_assignment PIN_R12   -to sdram_data[10]
set_location_assignment PIN_T12   -to sdram_data[11]
set_location_assignment PIN_T10   -to sdram_data[12]
set_location_assignment PIN_R10   -to sdram_data[13]
set_location_assignment PIN_T11   -to sdram_data[14]
set_location_assignment PIN_R11   -to sdram_data[15]

    #bank
set_location_assignment PIN_R7   -to sdram_ba[0]
set_location_assignment PIN_T7   -to sdram_ba[1]

    #dqm
set_location_assignment PIN_N2    -to sdram_dqm[0]
set_location_assignment PIN_T14   -to sdram_dqm[1]
    
    #时钟
set_location_assignment PIN_R4    -to sdram_clk

    #控制信号
set_location_assignment PIN_R14   -to sdram_cke
set_location_assignment PIN_T6    -to sdram_cs_n
set_location_assignment PIN_R6    -to sdram_ras_n
set_location_assignment PIN_T5    -to sdram_cas_n
set_location_assignment PIN_N1    -to sdram_we_n

